<form id="generalForm" class="form-horizontal" action="${ctx}/admin/general/save.do"  method="post">
    <div>
        <div class="col-sm-12">
            <div class="widget-box">
                <div class="widget-header">
                    <h4 class="widget-title">推广基础信息</h4>

                </div>
                <div class="widget-body">
                    <div class="widget-main">
                        <div class="form-group">
                            <label class="control-label col-xs-12 col-sm-2 no-padding-right" for="id">消息编号:</label>
                            <div class="col-xs-12 col-sm-4">
                                <div class="clearfix">
                                    <input type="text" name="id" id="id" class="col-xs-12 " readonly="" value="${notify.id!}"/>
                                </div>
                            </div>
                            <label class="control-label col-xs-12 col-sm-1 no-padding-right" for="id">消息标题:</label>
                            <div class="col-sm-4  ">
                                <div class="clearfix">
                                    <input type="text" name="id" id="msgTitle" class="col-xs-12 " value="${notify.msgTitle!}"/>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-xs-12 col-sm-2 no-padding-right" for="id">消息标题:</label>
                            <div class="col-sm-4  ">
                                <div class="clearfix">
                                    <div>
                                        <select class="form-control" name="msgShowType" id="msgShowType" data-placeholder="Choose a State...">
                                            <option value="1">普通</option>
                                            <option value="2">Banner</option>
                                        </select>
                                    </div>
                                </div>
                            </div>
                            <label class="control-label col-xs-12 col-sm-1 no-padding-right" for="id">是否循环推送:</label>
                            <div class="col-xs-12 col-sm-4">
                                <div class="clearfix">
                                    <select class="form-control" name="isLoopPush" id="isLoopPush" data-placeholder="Choose a State...">
                                        <option value="1">是</option>
                                        <option value="0">否</option>
                                    </select>
                                </div>
                            </div>

                        </div>
                        <div class="form-group">

                            <label class="control-label col-xs-12 col-sm-2 no-padding-right" for="id">循环推送时间点:</label>
                            <div class="col-sm-4  ">
                                <div class="clearfix">
                                    <input type="text" name="pushTimePoint" id="pushTimePoint" class="col-xs-12 " readonly="" value="${notify.pushTimePoint!}"/>
                                </div>
                            </div>
                            <label class="control-label col-xs-12 col-sm-1 no-padding-right" for="id">loopCycle:</label>
                            <div class="col-sm-4  ">
                                <div class="clearfix">
                                    <select class="form-control" name="loopCycle" id="loopCycle" data-placeholder="Choose a State...">
                                        <option value="0">不循环</option>
                                        <option value="1">每天</option>
                                        <option value="2">每周</option>
                                        <option value="3">每月</option>
                                        <option value="4">工作日</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-xs-12 col-sm-2 no-padding-right" for="id">开始时间:</label>
                            <div class="col-xs-12 col-sm-4">
                                <div class="clearfix">
                                    <input type="text" name="beginTime" id="beginTime" class="col-xs-12 " readonly="" value="${notify.beginTime!}"/>
                                </div>
                            </div>
                            <label class="control-label col-xs-12 col-sm-1 no-padding-right" for="id">结束时间:</label>
                            <div class="col-sm-4  ">
                                <div class="clearfix">
                                    <input type="text" name="endTime" id="endTime" class="col-xs-12 " readonly="" value="${notify.endTime!}"/>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="control-label col-xs-12 col-sm-2 no-padding-right" for="id">是否全屏:</label>
                            <div class="col-xs-12 col-sm-4">
                                <div class="clearfix">
                                    <select class="form-control" name="isFullScreen" id="isFullScreen" data-placeholder="Choose a State...">
                                        <option value="1">是</option>
                                        <option value="0">否</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <div>
                                <label class="control-label col-xs-12 col-sm-2" for="msgDescript">软件简介:</label>
                                <div class="control-label col-xs-10 col-sm-10 " >
                                    <textarea class=" col-sm-10 required maxlength:500" id="msgDescript" name="msgDescript" maxlength="500"></textarea>
                                </div>
                            </div>
                        </div>

                    </div>
                </div>
            </div>
        </div>
    </div>
    <!----上传截图块-------->
    <div >
        <div class="col-sm-12">
            <div class="widget-box">
                <div class="widget-header">
                    <h4 class="widget-title">上传软件截图</h4>

                </div>

                <div class="widget-body">
                    <div class="widget-main">
                        <div class="form-group">
                            <div class="col-xs-8">
                                <!-- #section:custom/file-input -->
                                <input type="file" id="id-input-screenshot" name="screenshotFile" id="id-input-screenshot" />
                            </div>
                            <button type="button" id="id-button-screenshot" class="btn btn-sm btn-success" onclick="uploadScreenShot()">
                                上传 <i class="ace-icon fa fa-arrow-right icon-on-right bigger-60"></i>
                            </button>
                        </div>
                    </div>
                </div>

                <div class="widget-body">
                    <div class="widget-main">
                        <div>
                            <ul id="screenshotul" class="ace-thumbnails clearfix">

                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>







</form>
<script src="${ctx}/static/admin/assets/js/jquery.validate.js"></script>
<script src="${ctx}/static/admin/assets/js/jquery.validate.messages_zh.js"></script>
<script type="text/javascript">


    $(document).ready(function(){
        $("#searchSoftButton").click(function(){
            var url="${ctx}/admin/soft/searchSoft.do";
            softId = $("#softId").val();
            softName = $("#softName").val();
            //将选中的一级下拉列表项的id传过去
            $.getJSON(url, {"id": softId,"softName":softName},function (data) {
                //对请求返回的JSON格式进行分解加载
                $("#softtbody").empty();
                $(data).each(function () {
                    content = '<tr></tr><td  align="center"><div class="radio"><label> <input name="softradio" type="radio" class="ace" /> <span class="lbl"> </span></label></div></td>'
                    +'<td  align="center">'+this.id+'</td>'
                    +'<td  align="center">'+this.softName+'</td></tr>'
                    $("#softtbody").append(content);
                });
            });
        });



        $(".date-picker").datepicker({
            language : 'zh-CN',
            autoclose: true,
            todayHighlight: true
        });

        $("#generalForm").validate({
            errorElement: 'div',
            errorClass: 'help-block',
            focusInvalid: true,
            highlight: function (e) {
                $(e).closest('.form-group').removeClass('has-info').addClass('has-error');
            },
            success: function (e) {
                $(e).closest('.form-group').removeClass('has-error');//.addClass('has-info');
                $(e).remove();
            },
            errorPlacement: function (error, element) {
                if(element.is('input[type=checkbox]') || element.is('input[type=radio]')) {
                    var controls = element.closest('div[class*="col-"]');
                    if(controls.find(':checkbox,:radio').length > 1) controls.append(error);
                    else error.insertAfter(element.nextAll('.lbl:eq(0)').eq(0));
                }
                else if(element.is('.select2')) {
                    error.insertAfter(element.siblings('[class*="select2-container"]:eq(0)'));
                }
                else if(element.is('.chosen-select')) {
                    error.insertAfter(element.siblings('[class*="chosen-container"]:eq(0)'));
                }
                else error.insertAfter(element.parent());
            },

            submitHandler: function (form) {
                generalType = $("#generalType").val();
                if(generalType == 1){
                    var softradio = $('input[name="softradio"]:checked').val();
                    if(!softradio){
                        alert("请选择软件");
                        return false;
                    }
                }else if(generalType == 0){
                    generalWord = $("#generalWord").val();
                    if(generalWord==""){
                        alert("请填写推广文字");
                    }
                }else if(generalType == 2){

                }else if(generalType == 4){
                    linkUrl = $("#linkUrl").val();
                    if(linkUrl==""){
                        alert("请填写外部链接");
                    }
                }
                form.submit();
            },
            invalidHandler: function (form) {
            }
        })
    });
</script>